<!--
 * @Description: 应用页面入口
 * @Version: 1.0
 * @Autor: jiajun wu
 * @Date: 2021-11-11 11:56:17
 * @LastEditors: jiajun wu
 * @LastEditTime: 2021-12-20 16:21:18
-->
<template>
  <a-config-provider :locale="lang[proxy.$i18n.locale]">
    <router-view />
  </a-config-provider>
</template>

<script lang="ts">
import { defineComponent, getCurrentInstance } from "vue";
import zh_CN from "ant-design-vue/es/locale/zh_CN";
import en_US from "ant-design-vue/lib/locale-provider/en_US";
import { Events } from "wasm";

export default defineComponent({
  name: "App",
  components: {},
  setup() {
    const proxy = getCurrentInstance()?.proxy;
    const lang = { "en-US": en_US, "zh-CN": zh_CN };

    let events = new Events();
    // events.on("a", () => {
    //   console.log(132);
    // });

    const a = (res: any) => {
      console.log(res, "a");
    };

    const b = (res: any) => {
      console.log(res, "b");
    };

    events.on("name", a);
    events.on("name", b);

    events.emit("name", 222);

    events.off("name", a);
    
    events.emit("name", 333);

    return {
      proxy,
      lang,
    };
  },
});
</script>

<style lang="less">
@import url("./components/global.less");
</style>